package com.jy.novel.listener;

import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;

/**
 * Created by jihb on 4/12/16.
 */
public class WebContextLoaderListener extends ContextLoaderListener {

    @Override
    public void contextInitialized(ServletContextEvent event) {
        super.contextInitialized(event);
        ServletContext servletContext = event.getServletContext();
        servletContext.setAttribute("ctx",servletContext.getContextPath());
//        WebApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(servletContext);

    }
}
